package 笔试.A网易;

import java.util.Scanner;

public class second {
    public static void main(String arg[]){//main--来自高金磊

         Scanner scanner=new Scanner(System.in);
         int a=scanner.nextInt();
         int b=scanner.nextInt();
         int middle=b;
         if (a>b){
             b=a;
             a=middle;
         }
         int x=scanner.nextInt();
         int y=scanner.nextInt();
         int res=0;
         if (x>=2*y){
             res+=a/x+b/x;
             if (a%x==0||b%x==0)
                 if(a%x==0&&b%x==0)
                     System.out.println(res);
                 else
                     System.out.println(res+1);
             else if (a%x<=y&&b%x<=y)
                 System.out.println(res+1);
             else
             {
                 System.out.println(res+2);
             }
         }
         else{
             res=a/y;
             if (a%y!=0){
                 res+=1;
             }
             b-=res*y;
             if (b<=0)
                 System.out.println(res);
             else
             if (y<x){
                 res+=b/x;
                 if (b%x!=0)
                     res++;
                 System.out.println(res);
             }
             else {
                 res+=b/y;
                 if (b%y!=0)
                     res++;
                 System.out.println(res);
             }
         }
    }
}
